package com.chapter13.MyCollection.MyMap.MyLinkedHashMap;

import java.util.*;

public class UseLinkedHashMap {
    public static void main(String[] args) {
        HashMap<String,Integer> hm = new HashMap<String,Integer>();
        hm.put("one",1);
        hm.put("two",2);
        hm.put("three",3);
        hm.put("four",4);

        //所有的键值对
        Set<Map.Entry<String,Integer>> entries = hm.entrySet();
        for (Map.Entry entry:entries){
            System.out.println(entry);
        }

        LinkedHashMap<String,Integer> lhm = new LinkedHashMap<String,Integer>();
        lhm.put("one",1);
        lhm.put("two",2);
        lhm.put("three",3);
        lhm.put("four",4);

        //所有的键值对
        entries = lhm.entrySet();
        for (Map.Entry entry:entries){
            System.out.println(entry);
        }

    }
}
